package de.uni.bremen.estudent.lbs.util;


import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;


/**
 * UIUtil class
 *
 * @author bahlfeld
 * @version 1.0 02.03.2012
 */
public final class UIUtil {

    /**
     * Checks if the device has honeycomb+ os.
     *
     * @return True if the ios is honeycomb or greater.
     */
    public static final boolean isHoneyCombOrGreater() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
    }

    /**
     * Checks if the device has ics+ os.
     *
     * @return
     */
    public static final boolean isIcsOrGreater() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH);
    }

    /**
     * Checks if the device is a tablet.
     *
     * @param context The app context.
     * @return True if the device is a tablet.
     */
    public static final boolean isTablet(Context context) {
        return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
    }

    /**
     * Checks if the device is a honeycomb+ tablet
     *
     * @param context The app context.
     * @return
     */
    public static final boolean isTabletAndHoneyComb(Context context) {
        return isTablet(context) && isHoneyCombOrGreater();
    }
}